import {ElMessage} from "element-plus";

function validateStencilDrop(nodeInfo, graph) {
  const startNode = graph.getCells().find(item => item.shape === 'start')

  if (!startNode && nodeInfo.key !== 'start') {
    ElMessage.warning('请先创建开始节点')
    return false
  }

  if (startNode && nodeInfo.key === 'start') {
    ElMessage.warning('开始节点只能创建一个')
    return false
  }

  if (nodeInfo.disabled) {
    ElMessage.warning('该功能暂未开放，敬请期待！')
    return false
  }

  return true
}

export default validateStencilDrop
